<template>
  <div class="slideshow_box">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item
        v-for="(value,index) in list"
        :key="index"
        @click.native="handleclick(value)"
        >
        <div>
          <img :src="value.linkData.linkPicUrl" :alt="value.linkData.linkTitle">
        </div>
      </van-swipe-item>
       
    </van-swipe>
  </div>
</template>

<script lang='ts'>
import { get } from '@u/http.ts'
import { Vue,Component,Prop } from 'vue-property-decorator'
@Component
export default class Swipe extends Vue {
  $router
  list:Array<object> = []

  async handleclick(value){
    let {linkData:{linkUrl}} = value
    let urllist = linkUrl.split('/')
    if(urllist[5] == 'song'){
      let id = urllist.pop()
        this.$router.push({
        // this['router'].push({
          path:'/music',
          query:{
            id,
          }
        })
    }else if(urllist[5] == 'album'){
      let albumId = urllist.pop()
      let result =await get({
        url:'/api/migu/list',
        params:{
          migu_url:'https://m.music.migu.cn/migu/remoting/cms_album_song_list_tag',
          albumId
        }
      })
      this.$router.push({
      // this['router'].push({
        path:`/songlist/`,
        query:{
          albumId     
        }
      })     
    }
  }
  async mounted () {
    let result = await get({
        url:'/api/migu/list',
        params:{
        migu_url:'https://m.music.migu.cn/migu/remoting/cms_list_tag?pageSize=10&nid=23831003&pageNo=0&type=2006',
        // pageSize:10,
        // nid:23831003,
        // pageNo:0,
        // type: 2006
        }
    })
    this.list = result.data.result.results
    console.log(this.list);
    
  }

}
</script>

<style lang="stylus" scoped>
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }
  div
    height 1.92rem
    img 
      height 100%


</style>